home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / newsgroups / misc.19970929-19971216 / 000259_news@newsmaster….columbia.edu _Thu Nov 13 22:30:20 1997.msg < prev    next >
Internet Message Format  |  2020-01-01  |  11KB

  1. Return-Path: <news@newsmaster.cc.columbia.edu>
  2. Received: from newsmaster.cc.columbia.edu (newsmaster.cc.columbia.edu [128.59.35.30])
  3.     by watsun.cc.columbia.edu (8.8.5/8.8.5) with ESMTP id WAA07512
  4.     for <kermit.misc@watsun.cc.columbia.edu>; Thu, 13 Nov 1997 22:30:20 -0500 (EST)
  5. Received: (from news@localhost)
  6.     by newsmaster.cc.columbia.edu (8.8.5/8.8.5) id WAA03448
  7.     for kermit.misc@watsun; Thu, 13 Nov 1997 22:30:20 -0500 (EST)
  8. Path: news.columbia.edu!psinntp!howland.erols.net!cpk-news-hub1.bbnplanet.com!news.bbnplanet.com!baron.netcom.net.uk!netcom.net.uk!dispose.news.demon.net!demon!bullseye.news.demon.net!demon!gate.news.unisource.nl!halley.pi.net!news
  9. From: pante@pi.net (Jan Mourer)
  10. Newsgroups: alt.lang.delphi,aus.electronics,comp.dcom.modems,comp.home.automation,comp.lang.pascal.delphi.misc,comp.protocols.kermit.misc,sci.electronics.design
  11. Subject: Re: Xmodem specs required
  12. Date: Thu, 13 Nov 97 21:06:57 GMT
  13. Organization: World Access/Planet Internet
  14. Message-ID: <64fqab$a0l@halley.pi.net>
  15. References: <64f01j$cno@granny.mac.co.nz>
  16. NNTP-Posting-Host: 145.220.210.29
  17. X-Newsreader: xagent-0.7.6 (c) off line news reader (in development) by Jan Mourer
  18. Lines: 217
  19. Xref: news.columbia.edu alt.lang.delphi:19557 aus.electronics:8567 comp.dcom.modems:204946 comp.home.automation:36087 comp.lang.pascal.delphi.misc:131385 comp.protocols.kermit.misc:8042 sci.electronics.design:59331
  20.  
  21. Hope this will help.
  22. The file got messed up years ago during a faulty xmodem download.
  23. It is probably copyright of whoever wrote it.
  24.  
  25.  
  26. XODEM PROTOCOL OVERVIEW  178 lines, 7.5K
  27.  
  28. 1/1/82 by Ward Christensen.  I will maintain a master copy of
  29. this.  Please pass on changes or suggestions via CBBS/Chicago
  30. at (312) 545-8086, or by voice at (312) 849-6279.
  31.  
  32. NOTE this does not include things which I am not familiar with,
  33. such as the CRC option implemented by John Mahr.
  34.  
  35. Last Rev: (none)
  36.  
  37. At the request of Rick Mallinak on behalf of the guys at
  38. Standard Oil with IBM P.C.s, as well as several previous
  39. requests, I finally decided to put my modem protocol into
  40. writing.  It had been previously formally published only in the
  41. AMRAD newsletter.
  42.  
  43.         Table of Contents
  44. 1. DEFINITIONS
  45. 2. TRANSMISSION MEDIUM LEVEL PROTOCOL
  46. 3. MESSAGE BLOCK LEVEL PROTOCOL
  47. 4. FILE LEVEL PROTOCOL
  48. 5. DATA FLOW EXAMPLE INCLUDING ERROR RECOVERY
  49. 6. PROGRAMMING TIPS.
  50.  
  51. -------- 1. DEFINITIONS.
  52. <soh>        01H
  53. <eot>        04H
  54. <ack>        06H
  55. <nak>        15H
  56. <can>        18H
  57.  
  58. -------- 2. TRANSMISSION MEDIUM LEVEL PROTOCOL
  59. Asynchronous, 8 data bits, no parity, one stop bit.
  60.  
  61.     The protocol imposes no restrictions on the contents of the
  62. data being transmitted.  No control characters are looked for
  63. in the 128-byte data messages.        Absolutely any kind of data may
  64. be sent - binary, ASCII, etc.  The protocol has not formally
  65. been adopted to a 7-bit environment for the transmission of
  66. ASCII-only (or unpacked-hex) data , although it could be simply
  67. by having both ends agree to AND the protocol-dependent data
  68. with 7F hex before validating it.  I specifically am referring
  69. to the checksum, and the block numbers and their ones-
  70. complement.
  71.     Those wishing to maintain compatibility of the CP/M file
  72. structure, i.e. to allow modemming ASCII files to or from CP/M
  73. systems should follow this data format:
  74.   * ASCII tabs used (09H); tabs set every 8.
  75.   * Lines terminated by CR/LF (0DH 0AH)
  76.   * End-of-file indicated by ^Z, 1AH.  (one or more)
  77.   * Data is variable length, i.e. should be considered a
  78.     continuous stream of data bytes, broken into 128-byte
  79.     chunks purely for the purpose of transmission.
  80.   * A CP/M "peculiarity": If the data ends exactly on a
  81.     128-byte boundary, i.e. CR in 127, and LF in 128, a
  82.     subsequent sector containing the ^Z EOF character(s)
  83.     is optional, but is preferred.  Some utilities or
  84.     user programs still do not handle EOF without ^Zs.
  85.   * The last block sent is no different from others, i.e.
  86.     there is no "short block".
  87.  
  88. -------- 3. MESSAGE BLOCK LEVEL PROTOCOL
  89.  Each block of the transfer looks like:
  90. <SOH><blk #><255-blk #><--128 data bytes--><cksum>
  91.     in which:
  92. <SOH>            = 01 hex
  93. <blk #>     = binary number, starts at 01 increments by 1, and
  94.               wraps 0FFH to 00H (not to 01)
  95. <255-blk #> = blk # after going thru 8080 "CMA" instr, i.e.
  96.               each bit complemented in the 8-bit block number.
  97.               Formally, this is the "ones complement".
  98. <cksum>     = the sum of the data bytes only.  Toss any carry.
  99.  
  100. -------- 4. FILE LEVEL PROTOCOL
  101.  
  102. ---- 4A. COMMON TO BOTH SENDER AND RECEIVER:
  103.  
  104.     All errors are retried 10 times.  For versions running with
  105. an operator (i.e. NOT with XMODEM), a message is typed after 10
  106. errors asking the operator whether to "retry or quit".
  107.     Some versions of the protocol use <can>, ASCII ^X, to
  108. cancel transmission.  This was never adopted as a standard, as
  109. having a single "abort" character makes the transmission
  110. susceptible to false termination due to an <ack> <nak> or <soh>
  111. being corrupted into a <can> and canceling transmission.
  112.     The protocol may be considered "receiver driven", that is,
  113. the ions running with
  114. an operator (i.e. NOT with XMODEM), a message is typed after 10
  115. errors asking the operator whether to "retry or quit".
  116.     Some versions of the protocol use <can>, ASCII ^X, to
  117. cancel transmission.  This was never adopted as a standard, as
  118. having a single "abort" character makes the transmission
  119. susceptible to false termination due to an <ack> <nak> or <soh>
  120. being corrupted into a <can> and canceling transmission.
  121.     The protocol may be considered "receiver driven", that is,
  122. the sender need not automatically re-transmit, although it does
  123. in the current implementations.
  124.  
  125. ---- 4B. RECEIVE PROGRAM CONSIDERATIONS:
  126.     The receiver has a 10-second timeout.  It sends a <nak>
  127. every time it times out.  The receiver's first timeout, which
  128. sends a <nak>, signals the transmitter to start.  Optionally,
  129. the receiver could send a <nak> immediately, in case the sender
  130. was ready.  This would save the initial 10 second timeout.
  131. However, the receiver MUST continue to timeout every 10 seconds
  132. in case the sender wasn't ready.
  133.     Once into a receiving a block, the receiver goes into a
  134. one-second timeout for each character and the checksum.  If the
  135. receiver wishes to <nak> a block for any reason (invalid
  136. header, timeout receiving data), it must wait for the line to
  137. clear.        See "programming tips" for ideas
  138.     Synchronizing:  If a valid block number is received, it
  139. will be: 1) the expected one, in which case everything is fine;
  140. or 2) a repeat of the previously received block.  This should
  141. be considered OK, and only indicates that the receivers <ack>
  142. got glitched, and the sender re-transmitted; 3) any other block
  143. number indicates a fatal loss of synchronization, such as the
  144. rare case of the sender getting a line-glitch that looked like
  145. an <ack>.  Abort the transmission, sending a <can>
  146.  
  147. ---- 4C. SENDING PROGRAM CONSIDERATIONS.
  148.  
  149.     While waiting for transmission to begin, the sender has
  150. only a single very long timeout, say one minute.  In the
  151. current protocol, the sender has a 10 second timeout before
  152. retrying.  I suggest NOT doing this, and letting the protocol
  153. be completely receiver-driven.        This will be compatible with
  154. existing programs.
  155.     When the sender has no more data, it sends an <eot>, and
  156. awaits an <ack>, resending the <eot> if it doesn't get one.
  157. Again, the protocol could be receiver-driven, with the sender
  158. only having the high-level 1-minute timeout to abort.
  159.  
  160.  
  161. -------- 5. DATA FLOW EXAMPLE INCLUDING ERROR RECOVERY
  162.  
  163. Here is a sample of the data flow, sending a 3-block message.
  164. It includes the two most common line hits - a garbaged block,
  165. and an <ack> reply getting garbaged.  <xx> represents the
  166. checksum byte.
  167.  
  168. SENDER                                        RECEIVER
  169.                                 times out after 10 seconds,
  170.                         <---                <nak>
  171. <soh> 01 FE -data- <xx> --->
  172.                         <---                <ack>
  173. <soh> 02 FD -data- xx        --->        (data gets line hit)
  174.                         <---                <nak>
  175. <soh> 02 FD -data- xx        --->
  176.                         <---                <ack>
  177. <soh> 03 FC -data- xx        --->
  178.    (ack gets garbaged)        <---                <ack>
  179. <soh> 03 FC -data- xx        --->                <ack>
  180. <eot>                        --->
  181.                         <---                <ack>
  182.  
  183. -------- 6. PROGRAMMING TIPS.
  184.  
  185. * The character-receive subroutine should be called with a
  186. parameter specifying the number of seconds to wait.  The
  187. receiver should first call it with a time of 10, then <nak> and
  188. try again, 10 times.
  189.   After receiving the <soh>, the receiver should call the
  190. character receive subroutine with a 1-second timeout, for the
  191. remainder of the message and the <cksum>.  Since they are sent
  192. as a continuous stream, timing out of this implies a serious
  193. like glitch that caused, say, 127 characters to be seen instead
  194. of 128.
  195.  
  196. * When the receiver wishes to <nak>, it should call a "PURGE"
  197. subroutine, to wait for the line to clear.  Recall the sender
  198. tosses any characters in its UART buffer immediately upon
  199. completing sending a block, to ensure no glitches were mis-
  200. interpreted.
  201.   The most common technique is for "PURGE" to call the
  202. character receive subroutine, specifying a 1-second timeout,
  203. and looping back to PURGE until a timeout occurs.  The <nak> is
  204. then sent, ensuring the other end will see it.
  205.  
  206. * You may wish to add code recommended by Jonh Mahr to your
  207. character receive routine - to set an error flag if the UART
  208. shows framing error, or overrun.  This will help catch a few
  209. more glitches - the most common of which is a hit in the high
  210. bits of the byte in two consecutive bytes.  The <cksum> comes
  211. out OK since counting in 1-byte produces the same result of
  212. adding 80H + 80H as with adding 00H + 00H.
  213. sender need not automatically re-transmit, although it does
  214. in the current implementations.
  215.  
  216. ---- 4B. RECEIVE PROGRAM CONSIDERATIONS:
  217.     The receiver has a 10-second timeout.  It sends a <nak>
  218. every time it times out.  The receiver's first timeout, which
  219. sends a <nak>, signals the transmitter to start.  Optionally,
  220. the receiver could send a <nak> immediately, in case the sender
  221. was ready.  This would save the initial 10 second timeout.
  222. However, the receiver MUST continue to timeout every 10 second
  223.  
  224.  
  225. >Hi,
  226. >I'm not sure which is best group for data communications but
  227. >does anyone have information regarding Xmodem protocol.
  228. >I am wanting to write 8051 code for data logger to communicate
  229. >with PC.(PC end will be Win 95 (Delphi 2 ) app.
  230. >
  231. >Please email me if you can help.
  232. >
  233. >Regards
  234. >Dave Huisman
  235. >
  236. >
  237. >